package com.simple.annotation.impl;

import cn.hutool.core.collection.CollUtil;
import com.simple.annotation.Instance;
import com.simple.manager.impl.InstanceManager;
import com.simple.tools.ReflectionsTool;

import java.util.Set;

public class InstanceImpl {

    public static void impl() {
        Set<Class<?>> classes = ReflectionsTool.getAnnotationByClass(Instance.class);
        if (CollUtil.isEmpty(classes)) {
            return;
        }
        InstanceManager instance = InstanceManager.getInstance();
        classes.forEach(instance::register);
    }
}
